package com.bookstore.service.impl;

import com.bookstore.service.UserService;
import com.bookstore.dao.UserDao;
import com.bookstore.dao.impl.UserDaoImpl;
import com.bookstore.entity.User;

public class UserServiceImpl implements UserService {
    UserDao userDao = new UserDaoImpl();

    @Override
    public int register(User user) {
        return userDao.insert(user);
    }

    @Override
    public User login(User user) {
        return userDao.queryByUsernameAndPassword(user);
    }

    @Override
    public boolean isExistsUsername(String username) {
        User user = userDao.queryByUsername(username);
        return user != null;
    }
}
